<template>
  <view class="question">
    <view class="container">
      <view class="questionItem" v-for="item in questionList">
        <view class="title">{{item.l_name}}</view>
        <AtList>
          <AtListItem
            :hasBorder="true"
            v-for="item in item.children"
            arrow='right'
            @click="gotoQD(item)"
            :title='item.l_name'
          />
        </AtList>
      </view>
    </view>
  </view>
</template>

<script setup>
import './index.scss'
import Taro, {useDidShow} from '@tarojs/taro'
import {ref} from 'vue'
import { AtListItem,AtList } from 'taro-ui-vue3'
import { query_guide_list } from  '../../http/api'

const questionList = ref()

useDidShow(() => {
  query_guide_list().then(res => {
    questionList.value = res.data
  })
})

// 跳转问题答案
const gotoQD = (row) => {
  Taro.navigateTo({
    url: `/pages/questionDetail/index?question=${row.l_name}&anstwer=${row.l_content}`
  })
}
Taro.showShareMenu({
  withShareTicket: true,
  menus: ['shareAppMessage', 'shareTimeline']
})
</script>
